package com.liuhengjia.springbootconfigfile.controller;

import com.liuhengjia.springbootconfigfile.service.EmailService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EmailController {
    //注入email配置信息实体类
    @Resource
    private EmailService emailService;

    /**
     * 测试方法
     *
     * @return
     */
    @RequestMapping("/send")
    public Boolean send() {
        // 收件人信箱
        String to = "liuhengjia1024@aliyun.com";
        // 邮件标题
        String title = "测试邮件";
        // 邮件正文
        String content = "你好~ hello~";
        // 发送邮件
        return emailService.send(to, title, content);
    }

}
